import cal from './cal';
/**
 * 判断组件是否有isCenter，居中属性，有的话设置网页的居中功能
 * @param isCenter 组件是否居中
 * @param shape
 * @returns {*}
 */
export default function convertShapeCenter(isCenter, shape) {
    if (isCenter && shape) {
        return shape.set('left', '50%').set('marginLeft', cal(shape.get('width'), undefined, a => -a / 2));
    }
    return shape;
};